<template>
  <div class="commnet-info" v-if="Object.keys(commentInfo).length !== 0">
    <div class="content">
      <div class="user">用户评价</div>
      <div class="more">更多</div>
    </div>
    <div class="info-detail">
      <div class="info-title">
        <img :src="commentInfo.user.avatar" alt="" />
        <span class="user-name">{{ commentInfo.user.uname }}</span>
      </div>

      <p>{{ commentInfo.content }}</p>

      <div class="info-other" v-if="commentInfo.created">
        <span class="info-datar">{{
          (commentInfo.created * 1000) | dateFormat
        }}</span>
        <span class="info-style">{{ commentInfo.style }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    commentInfo: {
      type: Object,
      default() {
        return [];
      },
    },
  },
};
</script>

<style scoped>
.content {
  width: 100%;
  height: 40px;
  line-height: 40px;
  overflow: hidden;
  border-bottom: 2px solid #ececec;
}
.user {
  float: left;
}
.more {
  float: right;
}
.commnet-info {
  padding: 0px 10px 10px;
  font-size: 14px;
}
.info-detail {
  padding-top: 20px;
}
.info-title {
  position: relative;
  height: 40px;
  line-height: 40px;
  margin-bottom: 20px;
}
.info-title * {
  vertical-align: middle;
}
.user-name {
  margin-left: 50px;
}
.info-title img {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 50%;
}
.info-detail p {
  line-height: 20px;
  margin-bottom: 15px;
}
.info-other {
  font-size: 12px;
  color: #bebebe;
}
.info-style {
  margin-left: 20px;
}
</style>